package com.guangli.ocr.viewmodel

import android.app.Application
import android.os.Bundle
import android.os.Parcel
import android.os.Parcelable
import androidx.databinding.ObservableField
import com.baidu.ocr.ui.camera.CameraActivity
import com.blankj.utilcode.util.ActivityUtils
import com.guangli.base.base.vm.RobotBaseViewModel
import com.guangli.ocr.ui.DrivingLicenseActivity
import com.guangli.ocr.ui.IdentificationCardActivity
import com.guangli.ocr.ui.VehicleLicenseActivity
import me.goldze.mvvmhabit.binding.command.BindingAction
import me.goldze.mvvmhabit.binding.command.BindingCommand

class MainViewModel(application: Application) : RobotBaseViewModel(application) {

    val token = ObservableField<String>()
    val toIdentificationClick = BindingCommand<Any>(BindingAction {
        val bundle = Bundle()
        bundle.putString(CameraActivity.KEY_NATIVE_TOKEN, token.get())
        ActivityUtils.startActivity(IdentificationCardActivity::class.java, bundle)
    })

    val toDrivingLicenseClick = BindingCommand<Any>(BindingAction {
        val bundle = Bundle()
        bundle.putString(CameraActivity.KEY_NATIVE_TOKEN, token.get())
        ActivityUtils.startActivity(DrivingLicenseActivity::class.java, bundle)
    })

    val toVehicleLicenseClick = BindingCommand<Any>(BindingAction {
        val bundle = Bundle()
        bundle.putString(CameraActivity.KEY_NATIVE_TOKEN, token.get())
        ActivityUtils.startActivity(VehicleLicenseActivity::class.java, bundle)
    })
}